package com.haohan.jingyuan.user.helper;

import com.haohan.jingyuan.user.dto.resp.UserInfoResp;
import com.haohan.jingyuan.user.entity.UserInfo;

/**
 * 用户信息响应对象转换工具类
 *
 * @ClassName UserInfoRespHelper
 * @Description 用户信息实体与响应对象转换工具
 * @Author hexijun
 * @Time 2025/01/18 23:45
 * @Version 1.0
 */
public class UserInfoRespHelper {

    /**
     * 将UserInfo实体转换为UserInfoResp响应对象
     *
     * @param userInfo 用户信息实体
     * @return 用户信息响应对象
     */
    public static UserInfoResp convert2UserInfoResp(UserInfo userInfo) {
        if (userInfo == null) {
            return null;
        }

        UserInfoResp userInfoResp = new UserInfoResp();
        
        // 复制基础字段
        userInfoResp.setId(userInfo.getId());
        userInfoResp.setUserId(userInfo.getUserId());
        userInfoResp.setUserName(userInfo.getUserName());
        userInfoResp.setPassWord(userInfo.getPassWord());
        userInfoResp.setStatus(userInfo.getStatus());
        userInfoResp.setCreator(userInfo.getCreator());
        userInfoResp.setGmtCreated(userInfo.getGmtCreated());
        userInfoResp.setModifier(userInfo.getModifier());
        userInfoResp.setGmtModified(userInfo.getGmtModified());
        userInfoResp.setIsDeleted(userInfo.getIsDeleted());

        return userInfoResp;
    }
}